package com.hxht.storage.server.pojo;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
//@Table(schema="storage")
public class NvrIpchannelInfo extends BaseEntity{
	
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "nvr_id", nullable = true)
	private NvrDeviceInfo nvrDevice;

	@OneToMany(mappedBy = "ipChannel")
	private Set<BaseRecordInfo> recordList;

	/**  协议类型
     0-HIK，1-PANASONIC，2-SONY，3-AXIS，4-SANYO，5-BOSCH，6-ZAVIO，7-GRANDEYE，
     8-PROVIDEO，9-ARECONT，10-ACTI，11-PELCO，12-VIVOTEK，13-INFINOVA，14-DAHUA，
     32-H264，33-MPEG4，34-SUNELL，35-ATEME，36-LAUNCH，37-YAAN，38-BLUESKY，
     39-BLUESKYLIMIT，40-TDWY，41-HBGK，42-SANTACHI，43-HIGHEASY，44-SAMSUNG，
     64-RTSP(url类型取流)，65-ONVIF */
    private Integer protocol;
    
    /** 取流模式<br/>
     *  1-直接从设备取流，2-通过URL取流 */
    private Integer streamMode;
    
    /** IP通道在线状态 <br/>
     * 0-不在线，1-在线 */
    private Boolean isOnline;
    
    /** NVR设备的IP通道号，注意区别 */
    private Integer dvrChannel;
    
    /** 标识该nvr ip通道是否空闲 */
    private Boolean isIdle;
    
    /** IP设备地址 */
	private String ip; 
	
	/** IP设备端口号  */
	private Integer port; 
	
	/** IP设备登陆用户名 */
	private String userName; 
	
	/** IP设备登录密码 */
	private String password;  
	
	private Integer deviceChannel;
	
//	private String streamUrl;
	
    
    public NvrIpchannelInfo(){}
    
	public Integer getDeviceChannel() {
		return deviceChannel;
	}

	public void setDeviceChannel(Integer deviceChannel) {
		this.deviceChannel = deviceChannel;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Boolean isIdle() {
		return isIdle;
	}

	public void setIsIdle(Boolean isIdle) {
		this.isIdle = isIdle;
		
		// ip通道被设置为空闲后，去除其绑定信息
		if (isIdle == true){
			this.deviceChannel = null;
			this.ip = null;
			this.isOnline = null;
			this.password =null;
			this.port = null;
			this.protocol = null;
			this.streamMode = null;
			this.userName = null;
		}
	}

	public Integer getProtocol() {
		return protocol;
	}

	public void setProtocol(Integer protocol) {
		this.protocol = protocol;
	}

	public Integer getStreamMode() {
		return streamMode;
	}

	public void setStreamMode(Integer streamMode) {
		this.streamMode = streamMode;
	}

	public Boolean isOnline() {
		return isOnline;
	}

	public void setIsOnline(Boolean isOnline) {
		this.isOnline = isOnline;
	}

	public Integer getNvrChannel() {
		return dvrChannel;
	}

	public void setDvrChannel(Integer dvrChannel) {
		this.dvrChannel = dvrChannel;
	}

	public NvrDeviceInfo getNvrDevice() {
		return nvrDevice;
	}

	public void setNvrDevice(NvrDeviceInfo nvrDevice) {
		this.nvrDevice = nvrDevice;
	}

	public Set<BaseRecordInfo> getRecordList() {
		return recordList;
	}

	public void setRecordList(Set<BaseRecordInfo> recordList) {
		this.recordList = recordList;
	}

	public Boolean getIsOnline() {
		return isOnline;
	}

	public Integer getDvrChannel() {
		return dvrChannel;
	}

	public Boolean getIsIdle() {
		return isIdle;
	}

	public void setPort(Integer port) {
		this.port = port;
	}

}
